|
|
@@ -169,7 +169,8 @@ module Agents
|
169
|
169
|
end
|
170
|
170
|
|
171
|
171
|
def validate_extract_options!
|
172
|
|
- case extract = interpolated['extract']
|
|
172
|
+ extraction_type = (extraction_type() rescue extraction_type(options))
|
|
173
|
+ case extract = options['extract']
|
173
|
174
|
when Hash
|
174
|
175
|
if extract.each_value.any? { |value| !value.is_a?(Hash) }
|
175
|
176
|
errors.add(:base, 'extract must be a hash of hashes.')
|
|
|
@@ -239,6 +240,8 @@ module Agents
|
239
|
240
|
errors.add(:base, "Wrong type of \"index\" value in extraction details for #{name.inspect}")
|
240
|
241
|
end
|
241
|
242
|
end
|
|
243
|
+ when /\{/
|
|
244
|
+ # Liquid templating
|
242
|
245
|
else
|
243
|
246
|
errors.add(:base, "Unknown extraction type #{extraction_type.inspect}")
|
244
|
247
|
end
|
|
|
@@ -382,7 +385,7 @@ module Agents
|
382
|
385
|
!interpolated['extract'].present? && extraction_type == "json"
|
383
|
386
|
end
|
384
|
387
|
|
385
|
|
- def extraction_type
|
|
388
|
+ def extraction_type(interpolated = interpolated())
|
386
|
389
|
(interpolated['type'] || begin
|
387
|
390
|
case interpolated['url']
|
388
|
391
|
when /\.(rss|xml)$/i
|